<%@page language="java"%>
<%@page contentType="text/html"%>
<%@page import="java.util.*, descriptor.*"%>

<jsp:include page="admin_generic_pre.jsp" >
	<jsp:param name="pagesubtitle" value="Create/Update a Company" />
</jsp:include>

	<p>
		<jsp:useBean id="infos" class="java.lang.String" scope="request" />
		<%= infos %>
	</p>
	<p>
		<jsp:useBean id="company" class="descriptor.CompanyDescriptor" scope="request" />
		<form method="POST" action="admin">
			<table>
				<tr><td>Name: </td><td><input type="text" name="name" value="<%= company.getName() %>" /></td></tr>
				<tr>
					<jsp:useBean id="allSectors" class="descriptor.SectorsListDescriptor" scope="request" />
					<td>Sector: </td>
					<td>
						<select name="sectorId">
							<% for (SectorDescriptor sd : allSectors.getSectorDescriptors()) {%>
								<option value="<%= sd.getID()%>" <%if (sd.getName() == company.getSector()){%>selected="selected"<%}%> ><%= sd.getName()%></option>
							<% } %>
						</select>
					</td>
				</tr>
				<tr>
					<jsp:useBean id="allCities" class="descriptor.CitiesListDescriptor" scope="request" />
					<td>City: </td>
					<td>
						<select name="cityId">
							<% for (CityDescriptor cd : allCities.getCityDescriptors()) {%>
								<option value="<%= cd.getID()%>" <%if (cd.getName() == company.getCity()){%>selected="selected"<%}%> ><%= cd.getName()%></option>
							<% } %>
						</select>
					</td>
				</tr>
			</table>
			<input type="hidden" name="companyId" value="<%= company.getId() %>" />
			<input type="hidden" name="action" value="companies_createupdate" />
			<input type="submit" name="button_createupdate" value="Create/Update" />
		</form>
	</p>
	
	
<jsp:include page="admin_generic_post.jsp" ></jsp:include>